/*
 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION!

import { int32, float32 } from "@koalaui/common"
import { KStringPtr, KBoolean, RuntimeType, runtimeType, isResource, isInstanceOf } from "@koalaui/interop"
import { NodeAttach, remember } from "@koalaui/runtime"
import { ComponentBase } from "./ComponentBase"
import { TypeChecker } from "#components"
import { ArkCommonMethodComponent } from "./ArkCommon"
import { ArkFolderStackPeer } from "./peers/ArkFolderStackPeer"
import { UseEventsProperties } from "./use_properties"
import { CommonMethod } from "./ArkCommonInterfaces"
import { FolderStackAttribute, OnFoldStatusChangeCallback, OnHoverStatusChangeCallback, FolderStackOptions } from "./ArkFolderStackInterfaces"
import { Alignment } from "./ArkEnumsInterfaces"
/** @memo:stable */
export class ArkFolderStackComponent extends ArkCommonMethodComponent {
    getPeer(): ArkFolderStackPeer {
        return (this.peer as ArkFolderStackPeer)
    }
    /** @memo */
    public setFolderStackOptions(options?: FolderStackOptions): this {
        if (this.checkPriority("setFolderStackOptions")) {
            const options_casted = options as (FolderStackOptions | undefined)
            this.getPeer()?.setFolderStackOptionsAttribute(options_casted)
            return this
        }
        return this
    }
    /** @memo */
    public alignContent(value: Alignment): this {
        if (this.checkPriority("alignContent")) {
            const value_casted = value as (Alignment)
            this.getPeer()?.alignContentAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onFolderStateChange(value: OnFoldStatusChangeCallback): this {
        if (this.checkPriority("onFolderStateChange")) {
            const value_casted = value as (OnFoldStatusChangeCallback)
            this.getPeer()?.onFolderStateChangeAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onHoverStatusChange(value: OnHoverStatusChangeCallback): this {
        if (this.checkPriority("onHoverStatusChange")) {
            const value_casted = value as (OnHoverStatusChangeCallback)
            this.getPeer()?.onHoverStatusChangeAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public enableAnimation(value: boolean): this {
        if (this.checkPriority("enableAnimation")) {
            const value_casted = value as (boolean)
            this.getPeer()?.enableAnimationAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public autoHalfFold(value: boolean): this {
        if (this.checkPriority("autoHalfFold")) {
            const value_casted = value as (boolean)
            this.getPeer()?.autoHalfFoldAttribute(value_casted)
            return this
        }
        return this
    }
    public applyAttributesFinish(): void {
        // we calls this function outside of class, so need to make it public
        super.applyAttributesFinish()
    }
}

/** @memo */
export function ArkFolderStack(
  /** @memo */
  style: ((attributes: ArkFolderStackComponent) => void) | undefined,
  /** @memo */
  content_: (() => void) | undefined,
  options?: FolderStackOptions | undefined
) {
    const receiver = remember(() => {
        return new ArkFolderStackComponent()
    })
    NodeAttach<ArkFolderStackPeer>((): ArkFolderStackPeer => ArkFolderStackPeer.create(receiver), (_: ArkFolderStackPeer) => {
        receiver.setFolderStackOptions(options)
        style?.(receiver)
        content_?.()
        receiver.applyAttributesFinish()
    })
}
